<div class="row-fluid">
    <div class="span12">
       <!-- <h4>Filter</h4>-->

        <table id="flex" class="table table-bordered">
            <thead>
                 <tr>
                     <th>Date</th>
                     <th>Student ID</th>
                     <th>Details</th>
                     <th>Fee Amount GHc</th>
                     <th>Total Paid GHc</th>
                     <th>Balance GHc</th>
                     <th>Served</th>
                     <th>Served Date</th>
                 </tr>
             </thead>
            <tbody>
            <?php
            $tl_paid = 0;
            $tl_fee_amount = 0;
            $tl_bal = 0;
            foreach ($data_table as $obj) {
                $paid = doubleval($obj['tl_credit_amount']) ;
                $fee_amount = doubleval($obj['amount']);
                $bal = doubleval($obj['balance']);

                $tl_paid = $tl_paid + $paid;
                $tl_fee_amount = $tl_fee_amount + $fee_amount;
                $tl_bal = $tl_bal + $bal;
                ?>
                <tr>
                    <td><?php echo $obj['date'];?></td>
                    <!--<td><?php /*echo $obj['id'];*/?></td>-->
                    <td><?php echo $obj['index_number'];?></td>
                    <td><?php echo $obj['name'];?></td>
                    <!-- <td><?php /*echo $obj['description'];*/?></td>-->
                    <td><?php echo $controller->formatNumber($obj['amount'],'money');?></td>
                    <td><?php echo $controller->formatNumber($obj['tl_credit_amount'],'money');?></td>
                    <td><?php echo $controller->formatNumber($obj['balance'],'money');?></td>
                    <td><?php echo $obj['served'];?></td>
                    <td><?php echo !empty($obj['served_date'])?$this->App->covertDate($obj['served_date'],'uis'):'';?></td>
                </tr>
                <?php
                //}
            }
            if($tl_fee_amount > 0){
                ?>
                <tr>
                    <td></td>
                    <td></td>
                    <!--<td></td>-->
                    <!-- <td></td>-->
                    <td><strong>Totals</strong></td>
                    <td><strong><?php echo $controller->formatNumber($tl_fee_amount,'money');?></strong></td>
                    <td><strong><?php echo $controller->formatNumber($tl_paid,'money');?></strong></td>
                    <td><strong><?php echo $controller->formatNumber($tl_bal,'money');?></strong></td>
                    <td></td>
                    <td></td>
                </tr>
            <?php
            }
            ?>
            </tbody>
        </table>
    </div>
</div>